# -*- coding: utf-8 -*-
from 考试系统.数据处理层.shuju import paper
from 考试系统.数据处理层.shuju import topic as topic1
def Topic_add(id,text,name,text_sample):
    topic_data = (id,text,name,text_sample)
    return topic1.create_topic_add(topic_data)
def Topic_show():
    Topics =topic1.get_all_questions()
    return Topics
def paper_creat(name,topic1s):
    return paper.create_paper(name,topic1s)
def paper_show():
    papers = paper.get_all_exams()
    return papers
def paper_name_find_topics(paper_name):
    return paper.get_questions_by_exam_name(paper_name)

def by_paper_Topic(topics):
    topic_new = list()
    for i in topics:
        topic_new.append(topic_out(i))
    return topic_new



def topic_out(id):
    topic = topic1.get_question_by_id(id)
    return topic
